From 2b831ec1ccf39559917e6eb30e7de9804e3b671f Mon Sep 17 00:00:00 2001 From: robertl Date: Sun, 17 Aug 2008 21:43:57 +0000 Subject: [PATCH] Generate internal links to our options in the doc. --- .../xmldoc/formats/options/osm-created_by.xml | 22 ++++++++ gpsbabel/xmldoc/makedoc.in | 51 ++++++++++++++++++- 2 files changed, 72 insertions(+), 1 deletion(-) create mode 100644 gpsbabel/xmldoc/formats/options/osm-created_by.xml diff --git a/gpsbabel/xmldoc/formats/options/osm-created_by.xml b/gpsbabel/xmldoc/formats/options/osm-created_by.xml new file mode 100644 index 000000000..bb0b8cd74 --- /dev/null +++ b/gpsbabel/xmldoc/formats/options/osm-created_by.xml @@ -0,0 +1,22 @@ + Use this value as custom created_by value in an OSM file. + + +With this pption, the given string is added as the 'created_by' field in +all the created nodes and ways. + + + + +gpsbabel -i INTYPE -f INFILE -o osm,created_by=somestring -O out.osm + + + + + If an empty string is given, the 'created_by' tag is omitted altogether. + + + + +gpsbabel -i INTYPE -f INFILE -o osm,created_by= -O out.osm + + diff --git a/gpsbabel/xmldoc/makedoc.in b/gpsbabel/xmldoc/makedoc.in index e807de9da..fbbe444f6 100755 --- a/gpsbabel/xmldoc/makedoc.in +++ b/gpsbabel/xmldoc/makedoc.in @@ -1,9 +1,11 @@ #!/usr/bin/perl # -# makedoc.in is used to generate makedoc. +# makedoc.in is used to generate makedoc. Editing makedoc is a bad ide. # +@options; + sub expandrw { my $read = shift; my $write = shift; @@ -39,6 +41,25 @@ sub expandoptions { $res; } +sub expandsuboptions { + my $f = shift; + my $res; + $olist = $options{$f}; + + # If no options, don't clutter things. + if ($olist eq "") { return; } + + # Comma separate the human-readable variation. + $olist =~ s/> , \n); $going = 0; $dooptions = 0; +# Prescan the argument list for options. + +for (@formats) { + chomp; + s/\&/\&/g; + s//\>/g; + @line = split "\t"; + + if (($line[0] eq 'file') || ($line[0] eq 'serial')) { + $fmt = $line[2]; + # Pennance for earlier sins. Rename magellan -> magellan1 here. + if ($line[4] eq "Magellan serial protocol") { + $fmt = "magellan1"; + } + $skipping = 0; + } + if ( $line[0] eq 'internal' || $line[5] eq 'xcsv') { + $skipping = 1; + } + if ($line[0] eq 'option' && $skipping == 0) { + $optname = $line[2]; + + $options{$fmt} .= "$optname "; + } +} + for (@formats) { chomp; @@ -125,6 +173,7 @@ for (@formats) { $line[4] ($line[2]) END print FILE expandoptions($line[1]); + print FILE expandsuboptions($id); $going = 1; $dooptions = 1; if ( defined($line[5]) && ($line[5] ne $line[2]) ) { -- 2.30.2